# Phalcon7
#
# VERSION               0.0.2

FROM php:7.4-fpm
MAINTAINER Dreamsxin "dreamsxin@qq.com"

# make sure the package repository is up to date
RUN apt-get update

RUN apt-get install -y openssh-server vim
RUN mkdir /var/run/sshd
RUN echo 'root:phalcon' |chpasswd

# RUN apt-get install -y apache2 libapache2-mod-php7.4 php7.4 php7.4-dev php7.4-pgsql php7.4-json php7.4-mcrypt re2c
RUN docker-php-ext-install json
RUN docker-php-ext-install mcrypt
RUN docker-php-ext-install pdo_pgsql

ADD ./cphalcon7/ /var/www/cphalcon7/
RUN ls /var/www
RUN ls /var/www/cphalcon7/ext
RUN cd /var/www/cphalcon7/ext && phpize && ./configure && make && make install
# ADD phalcon.ini /etc/php/7.0/mods-available/phalcon.ini
# RUN ln -s /etc/php/7.0/mods-available/phalcon.ini /etc/php/7.0/apache2/conf.d/
RUN docker-php-ext-enable phalcon

# Add ./demo /var/www/html/demo/
# ADD demo.conf /etc/apache2/sites-available/
# RUN a2ensite demo
# RUN a2enmod rewrite

COPY nginx.conf /etc/nginx/sites-enabled/default
COPY entrypoint.sh /etc/entrypoint.sh

COPY --chown=www-data:www-data ./demo /var/www/demo

WORKDIR /var/www/demo

EXPOSE 80 443 22

ENTRYPOINT ["/etc/entrypoint.sh"]
